Skip to content

Add Puppet proxy (CA) bulk actions#429

Merged
Manisha15 merged 1 commit into
masterfrom
new_all_hosts_page_puppet_proxy_actions
May 13, 2026
Merged

Add Puppet proxy (CA) bulk actions#429
Manisha15 merged 1 commit into
masterfrom
new_all_hosts_page_puppet_proxy_actions

Conversation

@nadjaheitmann

@nadjaheitmann nadjaheitmann commented Sep 24, 2025

Copy link
Copy Markdown
Collaborator

@adamruzicka @jeremylenz I have created a draft for the Puppet Proxy update bulk action. It is not more than a draft and I know there is a bunch of things missing (e.g. clearing proxy, CA proxy, tests, ...). I basically took code from Foreman and Katello and mixed it into this. Do you mind checking whether the general approach is the direction we want to go. UI wise, I think this is straight forward, but I was not sure whether

  • extending the BulkHostManager
  • adding a new API endpoint to the HostsBulkActionsController
  • adding the API endpoint itself to the Foreman rather than the foreman_puppet namespace

is the way to go.

I appreciate your opinions.

@adamruzicka adamruzicka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some notes inline, can't speak much to the frontend


api :PUT, "/hosts/bulk/change_puppet_proxy", N_("Change Puppet Proxy")
param_group :bulk_host_ids
param :proxy_id, :number, :required => true, :desc => N_("ID of the Puppet proxy to reassign the hosts to")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This being required means it can be used to reassign the host to a different proxy, but this cannot be used to unassign it, correct?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. I have not yet implemented the unassign method, so the implementation details about that one are still open.

Comment on lines +11 to +15
host.puppet_ca_proxy = proxy
else
host.puppet_proxy = proxy
end
host.save(:validate => false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need callbacks to be run or could we take a shortcut and assign the proxy with a single update query?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, if we need callbacks to be honest. The original action does run some validations about validating the proxy I think: https://github.com/theforeman/foreman_puppet/blob/master/app/controllers/concerns/foreman_puppet/extensions/hosts_controller_extensions.rb#L143

Can the update command also take the validate => false parameter?

Comment thread app/services/concerns/foreman_puppet/extensions/bulk_hosts_manager.rb Outdated
@nadjaheitmann nadjaheitmann force-pushed the new_all_hosts_page_puppet_proxy_actions branch from e2b1c7f to c7dd83c Compare September 24, 2025 12:15

@nadjaheitmann nadjaheitmann left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @adamruzicka !


api :PUT, "/hosts/bulk/change_puppet_proxy", N_("Change Puppet Proxy")
param_group :bulk_host_ids
param :proxy_id, :number, :required => true, :desc => N_("ID of the Puppet proxy to reassign the hosts to")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. I have not yet implemented the unassign method, so the implementation details about that one are still open.

Comment thread app/services/concerns/foreman_puppet/extensions/bulk_hosts_manager.rb Outdated
Comment on lines +11 to +15
host.puppet_ca_proxy = proxy
else
host.puppet_proxy = proxy
end
host.save(:validate => false)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, if we need callbacks to be honest. The original action does run some validations about validating the proxy I think: https://github.com/theforeman/foreman_puppet/blob/master/app/controllers/concerns/foreman_puppet/extensions/hosts_controller_extensions.rb#L143

Can the update command also take the validate => false parameter?

@nadjaheitmann nadjaheitmann force-pushed the new_all_hosts_page_puppet_proxy_actions branch 2 times, most recently from ac62ab7 to e980546 Compare September 24, 2025 12:48
@nadjaheitmann nadjaheitmann force-pushed the new_all_hosts_page_puppet_proxy_actions branch 3 times, most recently from 11c8919 to 4512e86 Compare October 13, 2025 07:52
@nadjaheitmann nadjaheitmann force-pushed the new_all_hosts_page_puppet_proxy_actions branch from 4512e86 to 2eb2f1a Compare January 21, 2026 17:09
@nadjaheitmann nadjaheitmann force-pushed the new_all_hosts_page_puppet_proxy_actions branch 3 times, most recently from 4bb7ef6 to 0faf7d6 Compare February 10, 2026 10:44
@nadjaheitmann nadjaheitmann force-pushed the new_all_hosts_page_puppet_proxy_actions branch 3 times, most recently from 75e0f00 to 7d7c810 Compare February 18, 2026 13:40
@nadjaheitmann nadjaheitmann force-pushed the new_all_hosts_page_puppet_proxy_actions branch from d68caaf to 0caaa68 Compare March 2, 2026 09:21

@jeremylenz jeremylenz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick read of the frontend code, a couple comments below

Comment thread webpack/src/Extends/Hosts/ActionsBar/index.js Outdated
Comment thread webpack/src/Extends/Hosts/ActionsBar/index.js Outdated
Comment thread webpack/src/Extends/Hosts/ActionsBar/index.js Outdated
Comment thread webpack/src/Extends/Hosts/ActionsBar/index.js Outdated
@nadjaheitmann

Copy link
Copy Markdown
Collaborator Author

This PR uses theforeman/foreman@40938e4 , so it will only work with Foreman 3.19+

@nadjaheitmann nadjaheitmann force-pushed the new_all_hosts_page_puppet_proxy_actions branch 9 times, most recently from 98fdd79 to dfb9239 Compare April 10, 2026 12:35
@nadjaheitmann nadjaheitmann force-pushed the new_all_hosts_page_puppet_proxy_actions branch 2 times, most recently from 1268415 to 7db72d3 Compare April 27, 2026 12:06
@nadjaheitmann nadjaheitmann force-pushed the new_all_hosts_page_puppet_proxy_actions branch 2 times, most recently from 0c74440 to 44484fc Compare May 6, 2026 08:38

@adamruzicka adamruzicka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I currently don't have an environment to test this, but code wise it looks good.

Comment thread app/controllers/foreman_puppet/api/v2/hosts_bulk_actions_controller.rb Outdated
Comment thread config/api_routes.rb
@nadjaheitmann nadjaheitmann force-pushed the new_all_hosts_page_puppet_proxy_actions branch from 44484fc to f3e13d0 Compare May 6, 2026 09:25
@nadjaheitmann nadjaheitmann requested a review from adamruzicka May 6, 2026 09:37
@nadjaheitmann

Copy link
Copy Markdown
Collaborator Author

environ

Thanks @adamruzicka . I accidentally requested another review from you, feel free to ignore that.

@nadjaheitmann nadjaheitmann changed the title Draft: Add Puppet proxy (CA) bulk actions Add Puppet proxy (CA) bulk actions May 7, 2026
@nadjaheitmann

Copy link
Copy Markdown
Collaborator Author

I currently don't have an environment to test this, but code wise it looks good.

I had a test session with @sbernhard and @Manisha15 . We tested the PR, verified that the permissions work and added a UI warning in case there is no smart proxy with Puppet(CA) feature available:

image image

@nadjaheitmann nadjaheitmann force-pushed the new_all_hosts_page_puppet_proxy_actions branch 2 times, most recently from 8d0052d to 015a91c Compare May 11, 2026 07:11
Comment thread app/services/concerns/foreman_puppet/extensions/bulk_hosts_manager.rb Outdated
Comment thread webpack/src/Extends/Hosts/ActionsBar/index.js
Comment thread webpack/src/Extends/Hosts/ActionsBar/index.js
@nadjaheitmann nadjaheitmann force-pushed the new_all_hosts_page_puppet_proxy_actions branch 5 times, most recently from b143112 to dc8e586 Compare May 11, 2026 08:31
Assisted-by: OpenAI Codex <codex@openai.com>
@nadjaheitmann nadjaheitmann force-pushed the new_all_hosts_page_puppet_proxy_actions branch from dc8e586 to 70afff5 Compare May 11, 2026 08:52
@nadjaheitmann

Copy link
Copy Markdown
Collaborator Author

@adamruzicka We had another internal review and testing round. I would go ahead and merge it if you don't mind. If there are bugs left, we can fix them in a follow-up.

@Manisha15 Manisha15 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Manisha15 Manisha15 merged commit f754e11 into master May 13, 2026
12 checks passed
@nadjaheitmann nadjaheitmann deleted the new_all_hosts_page_puppet_proxy_actions branch May 13, 2026 08:27
me-minus pushed a commit to me-minus/foreman_puppet that referenced this pull request Jun 20, 2026
Assisted-by: OpenAI Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants